package gtkwire.widget;

import gtkwire.*;
import gtkwire.widget.utils.*;

/**
*A bar of buttons and other widgets.
*/
public class GtkToolbar extends GtkContainer
{
        public GtkToolbar()
        {
		super();
		this.widgetType = WT_GtkToolbar;
		gtkCreate();
        }

        public GtkToolbar( String name, GladeKey key )
        {
		super( name, key );
		this.widgetType = WT_GtkToolbar;
        }

	/**
	*Insert a GtkToolItem into the toolbar at position pos. 
	*If pos is 0 the item is prepended to the start of the toolbar.
	*If pos is negative, the item is appended to the end of the toolbar.
	*/
	public void insert( GtkToolItem item, int index )
	{
		String[] msg = { item.getName(), Integer.toString(index) };
		app().sendCommand( name, GTKWireCommand.INSERT, msg );
	}

	/**
	*Sets whether to show an overflow menu when toolbar doesn't have room for all items on it. 
	*If TRUE, items that there are not room are available through an overflow menu.
	*/
	public void setShowArrow( boolean value )
	{
		app().sendCommand( name, GTKWireCommand.SET_SHOW, value );
	}

	/**
	*Sets whether a toolbar should appear horizontally or vertically.
	*/
	public void setOrientation( GtkOrientation orient  )
	{
		app().sendCommand( name, GTKWireCommand.SET_ORIENTATION, orient.getMode() );
	}

	/**
	*This function sets the size of stock icons in the toolbar. 
	*You can call it both before you add the icons and after they've been added. 
	*The size you set will override user preferences for the default icon size.
	*/
	public void setIconSize( GtkIconSize size )
	{
		app().sendCommand( name, GTKWireCommand.SET_SIZE, size.getSize() );
	}

	/**
	*Alters the view of toolbar to display either icons only, text only, or both.
	*/
	public void setStyle( GtkToolbarStyle style )
	{
		app().sendCommand( name, GTKWireCommand.SET_STYLE, style.getMode() );
	}

	/**
	*Unsets a toolbar style set with gtk_toolbar_set_style(), 
	*so that user preferences will be used to determine the toolbar style.
	*/
	public void setStyleDisabled()
	{
		app().sendCommand( name, GTKWireCommand.SET_DISABLED, "dummy" );
	}

}//end class
